<?php

/*	Vulpes-backend - Web-based managegent for wireless internet providers.
	Copyright (C) 2007 LinFox Serviços em Informática Ltda.

	This file is part of the Vulpes backend.

	Vulpes-backend is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Vulpes-backend is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.

 	Please note that any front-end (client application) that is distributed
	along with the Vulpes back-end, such as the Vulpes front-end by LinFox,
	is subject to it's correspending licene. */

require_once 'model.php';

class contract extends model
{
	function ping()
	{
		$arp = arp();
		foreach ($arp as $machine) {
			if ($this->status == 'L' && $machine['ip_address'] == $this->ip) {
				$ping_array = explode('/', exec('ping -q -c 1 '.$this->ip));
				return ereg_replace(' ms', '', $ping_array[4]);
			} else {
				return false;
			}
		}
	}
}

?>
